﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Dukou.Domain;

namespace Dukou.WebSiteDesigner.Domain
{
    public class Page : HibernateEntity<Int64>
    {
        public virtual string Url { get; set; }

        public virtual string Title { get; set; }

        public virtual IList<Container> Containers { get; set; }

        public virtual string Html { get; set; }

        public virtual DateTime UpdateTime { get; set; }

        public virtual string ToHtml() 
        {
            StringBuilder builder = new StringBuilder();
            builder.Append("@{");
            builder.Append("ViewBag.Title = \"get_page\";");
            builder.Append("Layout = \"~/Views/Shared/_Layout.cshtml\";");
            builder.Append("}");
            foreach (var item in this.Containers)
            {
                builder.Append(item.Html());
            }
            //builder.Append("<script type=\"text/javascript\">$(document).ready(function () {dkLayout.initContainer();});</script>");
            return builder.ToString();
        }
    }
}
